package com.cyq.day27.homework;

public class Movie implements Comparable<Movie>{
    private int id;
    private String MovieName;
    private String actor;
    private double price;

    public Movie() {
    }

    public Movie(int id, String movieName, String actor, double price) {
        this.id = id;
        MovieName = movieName;
        this.actor = actor;
        this.price = price;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getMovieName() {
        return MovieName;
    }

    public void setMovieName(String movieName) {
        MovieName = movieName;
    }

    public String getActor() {
        return actor;
    }

    public void setActor(String actor) {
        this.actor = actor;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    @Override
    public String toString() {
        return "Movie{" +
                "id=" + id +
                ", MovieName='" + MovieName + '\'' +
                ", actor='" + actor + '\'' +
                ", price=" + price +
                '}';
    }

    @Override
    public int compareTo(Movie o) {
        if(this.getId() < o.getId()){
            return -1;
        }
        else if(this.getId() > o.getId()){
            return 1;
        }
        else{
            return 0;
        }
    }
}
